package com.michau.testitas.common.model.answer;

import com.michau.testitas.common.model.BaseEntity;
import org.hibernate.annotations.CollectionOfElements;

import javax.persistence.*;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * User: michau
 * Date: 1/8/13
 * Time: 7:23 PM
 */
@Entity
@Table(name = "testit_answer")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "answer_type")
public abstract class Answer<T> extends BaseEntity{

    @Version
    @Column(name = "version", nullable = false)
    private long version;

    @ElementCollection
    @JoinTable(name = "testit_ans_choices_map",
                joinColumns = @JoinColumn(name = "id"))
    private Map<String, Boolean> choices;

    public abstract T getAnswerMode();
    public abstract void setAnswerMode(T answerMode);

}
